Repository navigation
feat: add web capabilities dashboard - #2100
Conversation
📝 WalkthroughWalkthroughAdds a packaged CLI web server entrypoint ( ChangesDashboard Web Server
Sequence DiagramsequenceDiagram
participant CLI
participant Server as HTTP Server
participant FileSystem
participant Browser
CLI->>Server: npm run dashboard:web
Server->>FileSystem: scan agents/, skills/, commands/, rules/
FileSystem-->>Server: parsed artifact data
Server->>FileSystem: load .mcp.json and mcp-configs/*.json
FileSystem-->>Server: MCP configs (masked env values)
Server->>FileSystem: load hooks/hooks.json
FileSystem-->>Server: hooks data
Server->>Server: renderHTML(data) -> embed datasets + i18n + client code
Server->>Server: http.createServer() and listen(PORT)
Server->>Browser: spawn browser with http://localhost:PORT
Browser->>Server: GET /
Server-->>Browser: rendered dashboard HTML
Browser->>Server: GET /api/data
Server-->>Browser: JSON datasets (agents, skills, commands, rules, MCPs, hooks)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~75 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 6
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@package.json`:
- Around line 344-345: The "dashboard:web" npm script references
scripts/dashboard-web.js but that file isn't included in the package whitelist,
so published installs won't have it; update package.json to ensure the file is
shipped by either adding "scripts/dashboard-web.js" (or the whole scripts/
directory) to the "files" array in package.json or move the script to a path
already included, and then verify the "dashboard:web" script still points to the
correct file name; refer to the "dashboard:web" script and the "files" array in
package.json and the actual file scripts/dashboard-web.js when making the
change.
In `@scripts/dashboard-web.js`:
- Around line 68-70: The code currently swallows JSON parse/read errors in
blocks that handle the '.mcp.json' file (variable m), the 'mcp-configs'
directory loop (fs.readdirSync -> f), and similarly for 'hooks/hooks.json' —
replace the empty catch{} blocks with explicit error handling that writes a
clear stderr warning including the filename/path and the error message (e.g.
using console.error or process.stderr.write) before continuing; update the catch
around JSON.parse(fs.readFileSync(...)) in both the m check and the mcp-configs
loop (and the hooks.json handling referenced) so the log shows which file failed
and the parse error to avoid silently dropping malformed configs.
- Around line 68-70: The code currently exposes full MCP env objects into the
response built by loadMcps (the r.push entries that include env: v.env || {}),
which is then served by the /api/data endpoint with Access-Control-Allow-Origin:
*; update loadMcps (or the logic producing those r.push items) to never include
raw secret values—either replace env with a list of keys (Object.keys(v.env ||
{})) or with redacted placeholders (e.g., map keys to "<redacted>") and remove
or tighten the wildcard CORS header on /api/data so cross-origin reads are not
allowed by default (only enable specific origins if truly required).
- Around line 494-500: The recent-item flow allows stored XSS because names are
injected into innerHTML and recents are persisted before verifying the route:
change the code so recents are only appended after a successful lookup (where
the route target is validated) and stop building the recent-bar with raw HTML
strings; instead, whitelist/validate r.t (allowed types: agents, skills,
commands, rules, mcps) and create each rb-item using document.createElement, set
element.textContent = r.n (not innerHTML) and attach its click via
element.addEventListener('click', () => location.hash =
'`#/`'+r.t+'/'+encodeURIComponent(r.n)) so names are not interpreted as HTML and
only validated targets are stored (update the logic around recents(), the
mapping that builds rb-items, and any code that persists r.n).
- Around line 537-540: renderSkills and the other render functions
(renderCommands, renderMcps, renderHooks) are inserting unescaped
repository-derived values directly into el.innerHTML and using inline onclick
handlers (e.g., copy(...), filterSkills(...)), which allows XSS; update each
renderer to never interpolate raw values into innerHTML — either build DOM nodes
via document.createElement and set textContent for names/descriptions/IDs or
ensure every inserted value passes esc() (apply esc() to s.n, s.d, command text,
IDs, etc.) and encode values used in attributes; replace inline onclick="..."
usages with data-* attributes (e.g., data-name/data-id) and attach event
listeners (e.g., click handlers using document.querySelectorAll or event
delegation) to call copy() or filterSkills, and ensure icon/class interpolation
(iBg, ICONS) cannot be influenced by external input.
- Around line 16-17: PORT currently comes directly from untrusted inputs
(process.argv[2] / ECC_DASHBOARD_PORT) without validation; change the code that
defines/uses PORT so you parse the value once, verify it is an integer within
1..65535, and if invalid print a clear error and exit with non‑zero status
before calling server.listen; update the constant used by listen (PORT) and add
the guard so values like "abc", negative numbers, zero, or >65535 fail fast with
a helpful message.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: bb6a5a68-c998-48f7-b1db-ac3ed07d70dd
📒 Files selected for processing (2)
package.jsonscripts/dashboard-web.js
| const PORT = parseInt(process.argv[2] || process.env.ECC_DASHBOARD_PORT || '3456', 10); | ||
| const ROOT = path.resolve(__dirname, '..'); |
There was a problem hiding this comment.
Validate PORT before calling listen().
process.argv[2] and ECC_DASHBOARD_PORT are system-boundary inputs. Values like abc, -1, or 70000 fall through until Node throws later. Parse once, range-check 1..65535, and fail with a clear message.
🔢 Suggested guard
-const PORT = parseInt(process.argv[2] || process.env.ECC_DASHBOARD_PORT || '3456', 10);
+const rawPort = process.argv[2] ?? process.env.ECC_DASHBOARD_PORT ?? '3456';
+const PORT = Number(rawPort);
+if (!Number.isInteger(PORT) || PORT < 1 || PORT > 65535) {
+ throw new Error(`Invalid ECC dashboard port "${rawPort}". Expected an integer between 1 and 65535.`);
+}As per coding guidelines, "Always validate all user input before processing at system boundaries" and "Fail fast with clear error messages when validation fails".
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@scripts/dashboard-web.js` around lines 16 - 17, PORT currently comes directly
from untrusted inputs (process.argv[2] / ECC_DASHBOARD_PORT) without validation;
change the code that defines/uses PORT so you parse the value once, verify it is
an integer within 1..65535, and if invalid print a clear error and exit with
non‑zero status before calling server.listen; update the constant used by listen
(PORT) and add the guard so values like "abc", negative numbers, zero, or >65535
fail fast with a helpful message.
| el.innerHTML = '<div class="filters" id="sf">'+['all','sec','test','pattern','design','research','data','agent','devops'].map((c,i)=>'<button'+(i===0?' class="active"':'')+' onclick="filterSkills(\\''+c+'\\',this)">'+[t('all'),'🔒 '+t('security'),'🧪 '+t('testing'),'📐 '+t('patterns'),'🎨 '+t('design'),'🔬 '+t('research'),'🗄️ '+t('data'),'🤖 '+t('agent'),'⚙️ '+t('devops')][i]+'</button>').join('')+ | ||
| '</div><div class="grid" id="sg">'+list.map((s,i)=>'<div class="card" onclick="location.hash=\\'#/skills/'+encodeURIComponent(s.n)+'\\'">'+ | ||
| '<div class="top"><div class="il"><div class="ic '+iBg(i%6)+'">'+ICONS[i%6]+'</div><span class="nm">'+esc(s.n)+'</span></div></div>'+ | ||
| '<div class="desc">'+(s.d||'—')+'</div><span class="ar">↗</span></div>').join('')+'</div>'; |
There was a problem hiding this comment.
Escape all repository-derived fields before writing innerHTML.
renderSkills, renderCommands, renderMcps, and renderHooks still interpolate raw descriptions, commands, IDs, and other file-backed values into HTML. A malicious markdown/JSON value like <img onerror=...> will execute in the browser. esc() needs to be applied consistently, and the inline onclick="copy('...')" pattern should be replaced with data attributes plus event listeners so quotes in names cannot break the markup.
As per coding guidelines, "Implement XSS prevention by sanitizing HTML output" and "Never trust external data (API responses, user input, file content)".
Also applies to: 545-550, 559-567, 584-590, 597-603
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@scripts/dashboard-web.js` around lines 537 - 540, renderSkills and the other
render functions (renderCommands, renderMcps, renderHooks) are inserting
unescaped repository-derived values directly into el.innerHTML and using inline
onclick handlers (e.g., copy(...), filterSkills(...)), which allows XSS; update
each renderer to never interpolate raw values into innerHTML — either build DOM
nodes via document.createElement and set textContent for names/descriptions/IDs
or ensure every inserted value passes esc() (apply esc() to s.n, s.d, command
text, IDs, etc.) and encode values used in attributes; replace inline
onclick="..." usages with data-* attributes (e.g., data-name/data-id) and attach
event listeners (e.g., click handlers using document.querySelectorAll or event
delegation) to call copy() or filterSkills, and ensure icon/class interpolation
(iBg, ICONS) cannot be influenced by external input.
There was a problem hiding this comment.
8 issues found across 2 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
|
Nice read-only dashboard and it's safe (XSS-escaped, env vars masked). Two things before merge: it adds 755 uncovered lines under scripts/** which trips the repo's 80% coverage gate (please add tests), and CI is currently red — get it green. Also note it partially overlaps the existing python |
…CPs, rules, and hooks
…handling, packaging
8db23e1 to
f870060
Compare
|
ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR. |
Rebased onto latest main, added 51 tests to hit the coverage gate, fixed the lint errors. Should be good to go now 👍 |
|
🤖 Bezalel Engine — Automated Code Review 1. SummaryAdds a Node-based dashboard server that exposes ECC metadata (agents, skills, commands, rules, MCP configs, hooks) via a local web UI. Registers a new npm script 2. Issues (bugs, vulns, logic)
|
- agent.yaml: register epic-* commands (#2236) and vue-review (#2241) - package.json files: drop stray skills/ml-adoption-playbook entry (follows orphan-skill publish pattern; not in install-modules.json) - unicode-safety: strip decorative emoji from dashboard-web.js (#2100) and brand-discovery refs (#2221) to pass the CI gate - agent-compress: raise catalog token canary 5000 -> 6000 for the 67-agent catalog Full suite green (2836/2836).
Summary
A comprehensive web-based ECC Capabilities Dashboard that displays all agents, skills, commands, rules, MCP configs, and hooks in a modern, searchable UI.
Features
Usage
Then open http://localhost:3456
Files Changed
scripts/dashboard-web.js— new dashboard server (single file, zero deps)package.json— addeddashboard:webnpm scriptSummary by cubic
Adds a web-based ECC Capabilities Dashboard to browse agents, skills, commands, rules, MCP configs, and hooks with fast search and drill-down. Runs as a zero-dependency Node server via
dashboard:webat http://localhost:3456, with a test suite covering loaders, API, and HTML rendering.New Features
scripts/dashboard-web.js(no external deps). Reads repo data and serves JSON at/api/data; auto-opens browser.Bug Fixes
scripts/dashboard-web.jsin published files;package.jsonaddsdashboard:webscript.tests/scripts/dashboard-web.test.jsand updated surface test to cover parsing, loaders, server routes, and HTML escaping.Written for commit f870060. Summary will update on new commits.
Summary by CodeRabbit